package com.gmics.unifiq.menu;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnChildClickListener;

import com.gmics.android.R;
import com.gmics.unifiq.adapter.FAQAdapter;

public class FAQ extends Activity {
	private ExpandableListView faqLV;
	private List<String> faqParent = new ArrayList<String>(), faqChild = new ArrayList<String>();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.faq_layout);
		
		String[] faq = getResources().getStringArray(R.array.faq);
		String[] ans = getResources().getStringArray(R.array.ans);
		
		for (int i = 0; i < faq.length; i++){
			faqParent.add(faq[i]);
			faqChild.add(ans[i]);
		}
		
		faqLV = (ExpandableListView) findViewById(R.id.faq_elv);
		final FAQAdapter faqAdapter = new FAQAdapter(this, faqParent, faqChild);
		faqLV.setAdapter(faqAdapter);
		faqLV.setOnChildClickListener(new OnChildClickListener(){

			@Override
			public boolean onChildClick(ExpandableListView elv, View v,
					int groupPos, int childPos, long id) {
				// TODO Auto-generated method stub
	            String selected = (String) faqAdapter.getChild(groupPos, childPos);
				return true;
			}
			
		});
	}


}
